package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class MethodInvocation implements NonparenthesizedValueExpressionPrimary {

    private int beginIndex;
    private int endIndex;
    private ValueExpressionPrimary valueExpressionPrimary;
    private DataType dataType;
    private Identifier methodName;
    private SqlArgumentList sqlArgumentList;

    public MethodInvocation(int beginIndex,
                            ValueExpressionPrimary valueExpressionPrimary,
                            DataType dataType,
                            Identifier methodName,
                            SqlArgumentList sqlArgumentList) {
        this.beginIndex = beginIndex;
        this.endIndex = sqlArgumentList != null ? sqlArgumentList.getEndIndex() : methodName.getEndIndex();
        this.valueExpressionPrimary = valueExpressionPrimary;
        this.dataType = dataType;
        this.methodName = methodName;
        this.sqlArgumentList = sqlArgumentList;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public ValueExpressionPrimary getValueExpressionPrimary() {
        return valueExpressionPrimary;
    }

    public DataType getDataType() {
        return dataType;
    }

    public Identifier getMethodName() {
        return methodName;
    }

    public SqlArgumentList getSqlArgumentList() {
        return sqlArgumentList;
    }

}
